﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>AddGoods</title>
 <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .add_Table tr td{ padding-top:10px; width:20px;}
        .add_Table{ text-align:right;}
        .inputLeft{ text-align:left;}
        .showError{ float: left; border:solid 2px #1E90FF;  width:100px; height:20px;}
         label.error{ color:Red;}
         .tdpadding{ padding-left:20px;}
    </style>
</head>
<body class="main">
    <div class="AllWebTopDiv">
        <div class="path">
            <div class="nav">
                <a href="#">新增商品</a>
            </div>
        </div>
        <div class="content">
            <form id="add_goods" method="post">
            <table class="add_Table">
                <tr>
                    <td>
                        <label>
                            商品编号：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("goodsId")%>
                    </td>
                    <td  class="tdpadding">
                        <label>
                            商品名称：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("goodsName")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            商品类别：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.DropDownList("goodsType")%>
                    </td>
                    <td class="tdpadding">
                        <label>
                            计量单位：</label>
                    </td>
                    <td class = "inputLeft">
                         <%:Html.DropDownList("unit")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            成本单价：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("finalCost")%>
                    </td>
                    <td class="tdpadding">
                        <label>
                            商品售价：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("price")%>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            是否折扣：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.RadioButton("radio", true, new { @id = "radio1", @checked = "true" })%> 是
                        &nbsp;&nbsp;&nbsp;
                        <%:Html.RadioButton("radio", false, new { @id = "radio2"})%> 否
                    </td>
                    <td class="tdpadding">
                        <label>
                            商品数量：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("amount")%>
                    </td>
                </tr>
                
            </table>
            <br />
            <br />
            <input type="submit" value="确认" class="button2" style=" margin-left:150px;"/>
             <input type="button" value="关闭" onclick="closeWindows()" class="button2"  style=" margin-left:50px;"/>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">

    $(document).ready(function () {

        $("#add_goods").validate({
            rules: {
                goodsId: { required: true,
                    digits: true
                },
                goodsName: {
                    required: true

                },
                finalCost: {
                    required: true,
                    number:true
                },
                price: {
                    required: true,
                    number: true

                },
                amount: {
                    required: true,
                    digits: true
                } 
            },
            messages: {
                goodsId: { required: "请输入商品编号",
                    digits: "请输入整数"
                },
                goodsName: { required: "请输入商品名称"
                },
                finalCost: { required: "请输入成本单价",
                    number: "请输入整数"
                },
                price: { required: "请输入商品售价",
                    number: "请输入整数"
                },
                 amount: { required: "请输入商品数量",
                     digits: "请输入整数"
                }
            },
            errorClass: "error"

        });
    });

    //关闭窗口
    function closeWindows() {
        var i = parent.layer.getFrameIndex();
        parent.layer.close(i);
    }
</script>
